using Admin2025.Application.Dtos;
using Admin2025.Application.IServices;
using Admin2025.Domain.Entities.App;
using Admin2025.Domain.Repositories;
using Microsoft.Extensions.Configuration;

namespace Admin2025.Application.Services;

public class FileService : IFileService
{
  private readonly IFileRepository _fileRepository;
  private readonly IConfiguration _config;

  public FileService(IFileRepository fileRepository, IConfiguration config)
  {
    _fileRepository = fileRepository;
    _config = config;
  }

  public async Task<AppFile?> UploadFileAsync(UploadFileDto dto, Guid userId)
  {
    return await _fileRepository.UploadFileAsync(dto.File, userId);
  }

  public async Task<AppFile?> GetFileByIdAsync(Guid id)
  {
    return await _fileRepository.GetByIdAsync(id);
  }

  public async Task<IEnumerable<AppFile>> GetAllFilesAsync()
  {
    return await _fileRepository.GetAllAsync();
  }
}